import request from '@/utils/request'

// 获取员工列表
export const getEmployeeList = (params) => request({
  method: 'get',
  url: '/sys/user',
  params
})

// 批量导出员工
export function exportEmployee() {
  return request({
    url: '/sys/user/export',
    method: 'get',
    responseType: 'blob'
  })
}

// 下载员工导入模版
export function downloadEmployeeTemplate() {
  return request({
    url: '/sys/user/import/template',
    method: 'get',
    responseType: 'blob'
  })
}

// 批量导入员工
export function uploadEmployee(data) {
  return request({
    url: '/sys/user/import',
    method: 'post',
    data
  })
}

// 删除员工
export function delEmployee(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

// 新增员工
export function addEmployee(data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

// 获取员工详情
export function getEmployeeDetail(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'get'
  })
}

// 修改员工信息
export function updateEmployee(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

// 分配员工角色
export function assignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
